#include <cctype>
#include <cstdio>
#include <cstring>
#include <queue>

typedef long long ll;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

const int N = 3e4 + 5, M = 2e5 + 5, P = 5;
const ll inf = 0x3f3f3f3f3f3f3f3f;
int n, m, p, e_cnt, heads[N], key[P];
bool vis[N];
ll f[N][1 << P];

struct Edge {
  int v, nxt, w;
} e[M << 1];

inline void add(int u, int v, int w) {
  e[++e_cnt].v = v, e[e_cnt].nxt = heads[u], heads[u] = e_cnt, e[e_cnt].w = w;
}

struct Node {
  int id;
  ll val;
  Node(int id, ll val) : id(id), val(val) {}
  inline bool operator<(const Node &rhs) const { return val > rhs.val; }
};

std::priority_queue<Node> pq;

inline void dij(int sta) {
  memset(vis, 0, sizeof(vis));
  while (!pq.empty()) {
    Node x = pq.top();
    pq.pop();
    if (vis[x.id]) continue;
    vis[x.id] = true;
    for (int i = heads[x.id], v; i; i = e[i].nxt)
      if (f[v = e[i].v][sta] > f[x.id][sta] + e[i].w) {
        f[v][sta] = f[x.id][sta] + e[i].w;
        pq.push(Node(v, f[v][sta]));
      }
  }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("work.in", "r", stdin);
  freopen("work.out", "w", stdout);
#endif
#endif

  while (read(n), read(m), read(p) || true) {
    if (n == 0 && m == 0 && p == 0) break;
    e_cnt = 0, memset(heads, 0, sizeof(heads));
    memset(f, (int)inf, sizeof(f));
    f[key[0] = 1][1] = 0;
    for (int i = 1; i <= p; ++i) { f[read(key[i])][1 << i] = 0; }
    ++p;
    for (int i = 1, u, v, w; i <= m; ++i) {
      read(u), read(v), read(w);
      add(u, v, w), add(v, u, w);
    }
    for (int i = 1, lim = 1 << p; i < lim; ++i) {
      for (int j = 1; j <= n; ++j) {
        for (int sta = i & (i - 1); sta; sta = i & (sta - 1))
          f[j][i] = std::min(f[j][i], f[j][sta] + f[j][i ^ sta]);
        if (f[j][i] != inf) pq.push(Node(j, f[j][i]));
      }
      dij(i);
    }
    printf("%lld\n", f[key[0]][(1 << p) - 1]);
  }
  return 0;
}